package com.zwr.sheller.shop.controller;

import com.zwr.sheller.core.common.JsonResult;
import com.zwr.sheller.core.common.WQQBusinessException;
import com.zwr.sheller.core.pojo.Store;
import com.zwr.sheller.shop.mapper.StoreMapper;
import com.zwr.sheller.shop.service.StoreBackgroundAndServiceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @Author: 18032
 * @Date: 14:50 2022/1/6
 */
@RestController
@RequestMapping("/background")
@Api(tags = "店铺背景设置和服务设置")
public class StoreBackgroundAndServiceController {

    @Autowired
    StoreBackgroundAndServiceService storeBackgroundAndServiceService;

    @PostMapping("/addBackground")
    @ApiOperation("店铺背景设置:点击修改背景")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "storeBackground",value = "店铺背景链接",dataType = "String",required = false),
            @ApiImplicitParam(name = "storeSetType",value = "店铺重复设置 0.不重复 1.左右平铺 2.垂直平铺",dataType = "Long",required = false),
            @ApiImplicitParam(name = "storeBackgroundColor",value = "店铺背景颜色,存放RGB值",dataType = "String",required = false),
            @ApiImplicitParam(name = "storeBackgroundOrColor",value = "店铺背景是否启用0.启用背景   1.启用颜色",dataType = "Boolean",required = false),
            @ApiImplicitParam(name = "storeSwitch",value = "店铺颜色或背景是否启用开关 ",dataType = "Boolean",required = false)
    })
    public Map<String,Object> addBackground(Store store) throws WQQBusinessException {
        Integer integer = storeBackgroundAndServiceService.addBackground(store);
        JsonResult jsonResult = new JsonResult();
        jsonResult.setCode("200");
        jsonResult.setField("msg","添加成功");
        return jsonResult.getMap();
    }


    @PostMapping("/hourArrive")
    @ApiOperation("店铺服务:12小时达")
    @ApiImplicitParam(name = "a",value = "是否12小时达",dataType = "Boolean")
    public Map<String,Object> hourArrive(Boolean a) throws WQQBusinessException {
        Integer integer = storeBackgroundAndServiceService.update12hour(a);
        JsonResult jsonResult = new JsonResult();
        jsonResult.setCode("200");
        jsonResult.setField("msg","修改成功");
        return jsonResult.getMap();
    }


    @PostMapping("/quality")
    @ApiOperation("店铺服务:质量保证")
    @ApiImplicitParam(name = "a",value = "质量保证",dataType = "Boolean")
    public Map<String,Object> quality(Boolean a) throws WQQBusinessException {
        Integer quality = storeBackgroundAndServiceService.quality(a);
        JsonResult jsonResult = new JsonResult();
        jsonResult.setCode("200");
        jsonResult.setField("msg","修改成功");
        return jsonResult.getMap();
    }


    @PostMapping("/addNew")
    @ApiOperation("店铺服务:破损补寄")
    @ApiImplicitParam(name = "a",value = "破损补寄",dataType = "Boolean")
    public Map<String,Object> addNew(Boolean a) throws WQQBusinessException {
        Integer integer = storeBackgroundAndServiceService.giveNewGood(a);
        JsonResult jsonResult = new JsonResult();
        jsonResult.setCode("200");
        jsonResult.setField("msg","修改成功");
        return jsonResult.getMap();
    }
}
